﻿package  {
	
	import flash.display.MovieClip;
	import flash.utils.Timer;
	import flash.events.TimerEvent;
	
	
	public class BattleFall extends MovieClip 
	{
		private var timer:Timer = new Timer( 10 );
		private var a:Number = 0.0;
		
		public function BattleFall() 
		{
			// constructor code
			
			timer.addEventListener( TimerEvent.TIMER , onTimer );
			timer.stop();
		}
		
		private function onTimer( e:TimerEvent ):void
		{
			a += 0.1;
			
			if	( a > 6.48 )
			{
				a = 0;
			}
			
			s1.x = Math.cos( a ) * 22;
			s1.y = Math.sin( a ) * 22; 
			
			s2.x = Math.cos( a + 2.1 ) * 22;
			s2.y = Math.sin( a + 2.1 ) * 22; 
			
			s3.x = Math.cos( a + 4.2 ) * 22;
			s3.y = Math.sin( a + 4.2 ) * 22;  
		}
		
		public function Fall( b:Boolean ):void
		{
			if ( b )
			{
				timer.start();
				this.visible = true;
			}
			else
			{
				timer.stop();
				this.visible = false;
			}
			
		}
	}
	
}
